Summary of Page Formatting and Dialog Box Customization
Constants and Data Types
Constants for Loop Status Information
enum { gxStopLooping = false, /* stop looping */ gxKeepLooping = true /* keep looping */ }; typedef Boolean gxLoopStatus; /* function for each format object associated with a job object */ typedef gxLoopStatus (*gxFormatProc) (gxFormat aFormat, void *refCon);Constants for Collection Item Categories and Tag IDs
Collection Item Categories
typedef short gxCollectionCategory; /* stored in collection object items' */ /* user attribute bits */ enum { gxNoCollectionCategory= (gxCollectionCategory) 0x0000,/* not volatile */ gxOutputDriverCategory= (gxCollectionCategory) 0x0001,/* affected by out- put printer */ gxFormattingDriverCategory= (gxCollectionCategory) 0x0002,/* affected by formatting printer */ gxDriverVolatileCategory= (gxCollectionCategory) 0x0004,/* volatile */ gxVolatileOutputDriverCategory = /* purge when output printer driver changes */ gxOutputDriverCategory + gxDriverVolatileCategory, gxVolatileFormattingDriverCategory = /* purge when formatting printer driver changes */ gxFormattingDriverCategory + gxDriverVolatileCategory };Collection Tag ID
enum { gxPrintingTagID = -28672 );/* QuickDraw GX assigns its collection objects with the same 4-byte ID */Constants and Data Types for Job Collection Items
Print-Job Information
enum { gxJobTag = 'job ' }; /* item ID for the print-job item */ /* job object information structure */ struct gxJobInfo { long numPages; /* total number of pages to print */ long priority; /* print job's priority */ long timeToPrint; /* designated time to print a print job */ long jobTimeout; /* time to cancel print job, in ticks */ long firstPageToPrint /* first page to begin printing */ short jobAlert; /* when to alert the user about printing */ Str31 appName; /* name of application used to create the */ /* printable document */ Str31 documentName; /* name of the user's document */ Str31 userName; /* name of the user associated with the */ /* printable document */ } ; enum { /* print-job priorities */ gxPrintJobUrgent = 0x00000001, /* priority of print job is */ /* "urgent" */ gxPrintJobAtTime = 0x00000002, /* designated time to print the */ /* print job */ gxPrintJobASAP = 0x00000003 /* designated time to print the */ /* print job is "as soon as */ /* possible" */ }; enum { gxPrintJobHoldingBit = 0x00001000 }; /* reserved bit in the priority field indicates a print job on hold */ enum { /* print-job holding status */ gxPrintJobHolding = (gxPrintJobHoldingBit + gxPrintJobASAP), gxPrintJobHoldingAtTime = (gxPrintJobHoldingBit + gxPrintJobAtTime), gxPrintJobHoldingUrgent = (gxPrintJobHoldingBit + gxPrintJobUrgent) }; enum { /* print-job alert constants */ gxNoPrintTimeAlert= 0, /* don't alert user when printing */ gxAlertBefore = 1, /* alert user before printing */ gxAlertAfter = 2, /* alert user after printing */ gxAlertBothTimes = 3 /* alert user before and after printing */ }; enum { /* time to cancel print job */ gxThirtySeconds = 1800, /* cancel print job in 30 seconds (in ticks) */ gxTwoMinutes = 7200 /* cancel print job in 2 minutes (in ticks) */ };Collation Information
enum { gxCollationTag = 'sort' };/* item ID for the collation item*/ /* collation information stucture */ struct gxCollationInfo { Boolean collation; /* indicates whether or not to collate */ /* copies */ };Copies Information
enum { gxCopiesTag = 'copy' };/* item ID for the copies item*/ /* copies information structure */ struct gxCopiesInfo { long copies; /* number of copies of a document to print */ };Page-Range Information
enum { gxPageRangeTag = 'rang' };/* item ID for the page-range item */ /* page-range information structure */ struct gxPageRangeInfo { gxSimplePageRangeInfo simpleRange; /* simple page range */ /* information */ Str31 fromString; /* beginning of customized */ /* page range */ Str31 toString; /* end of customized page */ /* range */ long minFromPage; /* minimum of default page */ /* range */ long maxToPage; /* maximum of default page */ /* range */ char replaceString[1]; /* page-range replacement */ /* string */ } ; /* simple page-range information structure */ struct gxSimplePageRangeInfo { char optionChosen; /* specific page-range option */ Boolean printAll; /* true if user wants to print all pages of a */ /* document */ long fromPage; /* first page in page range */ long toPage; /* last page in page range */ }; enum { /* page-range options */ gxDefaultPageRange = (char) 0, /* use default numeric page range */ gxReplacePageRange = (char) 1, /* use editable text field */ gxCustomizePageRange = (char) 2 /* use alphanumeric page range */ };Quality Information
enum { gxQualityTag = 'qual' }; /* item ID for the quality item*/ /* quality information structure */ struct gxQualityInfo { Boolean disableQuality; /* true to disable standard quality */ /* controls */ short defaultQuality; /* default quality */ short currentQuality; /* current quality */ short qualityCount; /* number of quality menu items in */ /* Quality pop-up menu */ char qualityNames[1]; /* Quality pop-up menu names, such as */ /* "Best" */ };File-Destination Information
enum { gxFileDestinationTag = 'dest' };/* item ID for the file- */ /* destination item*/ /* file-destination information structure */ struct gxFileDestinationInfo { Boolean toFile; /* true if destination is a file */ };File-Location Information
enum { gxFileLocationTag = 'floc' } /* item ID for the file- */ /* location item*/ /* file-location information structure */ struct gxFileLocationInfo { FSSpec fileSpec; /* location of file */ };File-Format Information
enum { gxFileFormatTag = 'ffmt' }; /* item ID for the file- */ /* format item*/ /* file-format information structure */ struct gxFileFormatInfo { Str31 fileFormatName; /* name of file format */ };File-Fonts Information
enum { gxFileFontsTag = 'incf' }; /* item ID for the file-fonts item */ /* file-fonts information structure */ struct gxFileFontsInfo { char includeFonts; /* font include level; if destination is file */ }; enum { /* font include levels */ gxIncludeNoFonts = (char) 1, gxIncludeAllFonts = (char) 2, gxIncludeNonStandardFonts = (char) 3 };Paper-Feed Information
enum { gxPaperFeedTag = 'feed' };/* item ID for paper-feed item */ /* paper-feed information structure */ struct gxPaperFeedInfo { Boolean autoFeed; /* true if automatic feed, false if */ /* manual feed */ };Manual-Feed Information
enum { gxManualFeedTag = 'manf' };/* item ID for manual-feed item */ /* manual-feed information structure */ struct gxManualFeedInfo { long numPaperTypeNames; /* number of paper-type objects to /* manually feed */ Str31 paperTypeNames[1]; /* names of paper-type objects to */ /* manually feed */ };Standard Mapping Information
enum { gxNormalMappingTag = 'nmap' }; /* item ID for the standard */ /* mapping item */ /* standard mapping information structure */ struct gxNormalMappingInfo { Boolean normalPaperMapping; /* true if not overriding standard */ /* paper matching */ };Special Mapping Information
enum { gxSpecialMappingTag = 'smap' }; /* item ID for special mapping */ /* special mapping information structure */ struct gxSpecialMappingInfo { char specialMapping; /* specific paper-mapping option */ } ; enum { /* paper-mapping options */ gxRedirectPages = (char) 1, /* user wants to crop redirected pages */ gxScalePages = (char) 2, /* user wants to scale pages */ gxTilePages = (char) 3 /* user wants to tile pages */ };Tray-Mapping Information
enum { gxTrayMappingTag = 'tmap' }; struct gxTrayMappingInfo{ gxTrayIndex mapPaperToTray; /* tray to map all paper to */ }; typedef long gxTrayIndex; /* specifies the paper tray setting */Print-Panel Information
enum { gxPrintPanelTag = 'ppan' }; /* item ID for the Print */ /* panel item */ /* print-panel information structure */ struct gxPrintPanelInfo { Str31 startPanelName; /* name of starting panel in /* Print dialog box */ };Format-Panel Information
enum { gxFormatPanelTag = 'fpan' }; /* item ID for the format */ /* panel item */ /* format-panel information structure */ struct gxFormatPanelInfo { /* name of starting panel in */ Str31 startPanelName; /* Page Setup dialog box */ };Paper-Mapping Information
enum { gxPaperMappingTag = 'pmap' };/* item ID for print- */ /* panel item */ /* This collection item contains a flattened paper-type object resource. */Translated-Document Information
enum { gxTranslatedDocumentTag = 'trns' }; struct gxTranslatedDocumentInfo { long translatorInfo; /* information from the translation process */ };Constants and Data Types for Format Collection Items
Orientation Information
enum { gxOrientationTag = 'layo' }; /* item ID for the */ /* orientation item */ /* orientation information structure */ struct gxOrientationInfo { char orientation; /* an enumerated orientation value */ } ; enum { /* orientation options */ gxPortraitLayout = (char) 0, /* user wants portrait orientation */ gxLandscapeLayout = (char) 1, /* user wants landscape orientation */ gxRotatedPortraitLayout = (char) 2, /* rotated portrait orientation, not user specifiable*/ gxRotatedLandscapeLayout =(char) 3 /* user wants rotated landscape */ /* orientation */ };Scaling Information
enum { gxScalingTag = 'scal' }; /* item ID for the scaling item */ /* scaling information structure */ struct gxScalingInfo { Fixed horizontalScaleFactor; /* current horizontal scaling */ /* factor */ Fixed verticalScaleFactor; /* current vertical scaling factor */ short minScaling; /* minimum current scaling factor */ short maxScaling; /* maximum current scaling factor*/ };Direct-Mode Information
enum { gxDirectModeTag = 'dirm' }; /* item ID for the direct- */ /* mode item */ /* direct-mode information structure */ struct gxDirectModeInfo { Boolean directModeOn; /* true if direct mode is enabled */ };Format-Halftone Information
enum { gxFormatHalftoneTag = 'half' }; /* item ID for the special */ /* mapping item */ /* format-halftone information structure */ struct gxFormatHalftoneInfo { long numHalftones; /* number of halftones */ gxHalftone halftones[1]; /* any number of halftones */ };Page-Inversion Information
enum { gxInvertPageTag = 'invp' }; /* item ID for the page- */ /* inversion item */ /* page-inversion information structure */ struct gxInvertPageInfo { Boolean invert; /* if true, invert the page */ }; /* if missing or false, don't invert */ /* the page */Horizontal Page-Flip Information
enum { gxFlipPageHorizontalTag = 'flph' }; /* item ID for the */ */ horizontal page-flip item */ /* horizontal flip-page information structure */ struct gxFlipPageHorizontalInfo{ Boolean flipHorizontal; /* if true, flip x coordinates on the */ }; /* page; if missing or false, don't flip */Vertical Page-Flip Information
enum { gxFlipPageVerticalTag = 'flpv' }; /* item ID for the */ /* vertical page-flip item */ /* vertical page-flip information structure */ struct gxFlipPageVerticalInfo { Boolean flipVertical; /* if true, flip y coordinates on the */ }; /* page; if missing or false, don't flip */Precise-Bitmap Information
enum { gxPreciseBitmapsTag = 'pbmp' }; /* item ID for the precise- */ /* bitmap item */ /* precise-bitmap information structure */ struct gxPreciseBitmapInfo { Boolean preciseBitmaps; /* if true, scale the page by 96% */ }; /* if missing or false, don't scale */Paper-Type Lock Information
enum { gxPaperTypeLockTag = 'ptlk' }; /* item ID for the paper- */ /* type lock item*/ /* paper-type object lock information structure */ struct gxPaperTypeLockInfo { Boolean paperTypeLocked; /* true if paper-type object */ }; /* is locked */Constants and Data Types for Paper-Type Collection Items
Base Information
enum { gxBaseTag = 'base' }; /* item ID for the base item */ /* base type information structure */ struct gxBaseInfo { long baseType; /* base type chosen */ } ; enum { /* paper-type object base types */ gxUnknownBase = 0, /* unknown base type */ gxUsLetterBase = 1, /* US letter base type */ gxUsLegalBase = 2, /* US legal base type */ gxA4LetterBase = 3, /* A4 letter base type */ gxB5LetterBase = 4, /* B5 letter base type */ gxTabloidBase = 5 /* tabloid base type */ };Creator Information
enum { gxCreatorTag = 'crea' }; /* item ID for the creator item */ /* creator information structure */ struct gxCreatorInfo { OSType creator; /* creator of the paper-type object */ }; enum { /* paper-type object creator type */ gxSysPaperType = 'sypt', /* system paper-type object creator */ gxUserPaperType = 'uspt' /* user paper-type object creator */ /* if printer driver creates a paper-type object, use printer /* driver's creator type */ };Units Information
enum { gxUnitsTag = 'unit' }; /* item ID for the units item */ /* unit information structure */ struct gxUnitsInfo { char units; /* specific paper-type object */ /* measurement */ }; enum { /* paper-type object units */ gxPicas = (char) 0, /* pica measurement */ gxMms = (char) 1, /* millimeter measurement */ gxInches = (char) 2 /* inches measurement */ };Flags Information
enum { gxFlagsTag = 'flag' }; /* item ID for the flags item */ /* flags information structure */ typedef struct { long flags; /* paper-type object flags */ }gxFlagsInfo; enum { /* paper-type object flags (bit positions) */ gxOldPaperTypeFlag = 0x00800000, /* indicates a paper-type object */ /* with 7.0 settings */ gxNewPaperTypeFlag = 0x00400000, /* indicates a paper-type object */ /* with post 7.0 settings */ gxOldAndNewPaperTypeFlag= 0x00C00000, /* indicates a paper-type object */ /* that is both old and new */ gxDefaultPaperTypeFlag = 0x00100000, /* indicates the default paper */ /* type */ };Comment Information
enum { gxCommentTag = 'cmnt' }; /* item ID for the comment item */ /* comment information structure */ struct gxCommentInfo { Str255 comment; /* paper-type object comment */ } ;Panel-Related Constants and Data Types
QuickDraw GX Dialog Box Panel Information
/* constants for overriding messages when adding dialog box panels */ #define gxJobStatus 3 #define gxPrintingEvent 4 #define gxJobDefaultFormatDialog 5 #define gxFormatDialog 6 #define gxJobPrintDialog 7 #define gxFilterPanelEvent 8 #define gxHandlePanelEvent 9 #define gxParsePageRange 10 /* dialog box related resources */ #define gxXdtlRadioButtons 0 #define gxXdtlCheckBox 1 #define gxXdtlEditTextInteger 2 #define gxXdtlEditTextReal 3 #define gxXdtlEditTextString 4 #define gxXdtlPopUp 5The Panel Information Structure
struct gxPanelInfoRecord { gxPanelEvent panelEvt; /* the event */ short panelResId; /* resource ID of current panel resource */ DialogPtr pDlg; /* pointer to dialog */ EventRecord *theEvent; /* pointer to event */ short itemHit; /* actual item number of event */ short itemCount; /* number of items before your items */ short evtAction; /* the action that will occur after this event is processed */ short errorStringId; /* 'STR ' ID of error string */ gxFormat theFormat; /* the current format */ void *refCon; /* refCon from gxPanelSetupRecord */ };Panel Events
enum { gxPanelNoEvt = (gxPanelEvent) 0, /* no event */ gxPanelOpenEvt = (gxPanelEvent) 1, /* panel is about to open */ gxPanelCloseEvt = (gxPanelEvent) 2, /* panel is about to close */ gxPanelHitEvt = (gxPanelEvent) 3, /* user has selected item */ gxPanelActivateEvt= (gxPanelEvent) 4, /* panel has been activated */ gxPanelDeactivateEvt= (gxPanelEvent) 5, /* panel has been deactivated */ gxPanelIconFocusEvt= (gxPanelEvent) 6, /* focus has changed to icons */ gxPanelPanelFocusEvt= (gxPanelEvent) 7, /* focus has changed to panel */ gxPanelFilterEvt = (gxPanelEvent) 8, /* panel event needs to be filtered */ gxPanelCancelEvt = (gxPanelEvent) 9, /* panel has been canceled */ gxPanelConfirmEvt = (gxPanelEvent) 10, /* panel has been confirmed */ gxPanelDialogEvt = (gxPanelEvent) 11, /* panel event to be handled by the dialog box handler */ gxPanelOtherEvt = (gxPanelEvent) 12, /* an OS event has occurred in the panel */ gxPanelUserWillConfirmEvt = (gxPanelEvent) 13 /* user has selected OK */ }; typedef long gxPanelEvent;Panel Responses
enum { gxPanelNoResult = 0, /* no result from panel */ gxPanelCancelConfirmation = 1, /* user confirmed panel, but panel handler discovered an error */ }; typedef long gxPanelResult;Panel Event Actions
enum { gxOtherAction = 0, /* current item doesn't change after event */ gxClosePanelAction = 1, /* panel is closed after event */ gxCancelDialogAction = 2, /* dialog box is canceled after event */ gxConfirmDialogAction= 3 /* dialog box is confirmed after event */ };The Panel Setup Structure
struct gxPanelSetupRecord { gxPrintingPanelKind panelKind; /* kind of program using panel */ short panelResId; /* resource ID of panel */ short resourceRefNum; /* resource file refnum of panel */ void *refCon; /* pointer to panel setup structure used to build panel */ };Printing Panel Kinds
enum { gxApplicationPanel= (gxPrintingPanelKind) 0, /* an application panel */ gxExtensionPanel = (gxPrintingPanelKind) 1, /* printing extension panel */ gxDriverPanel = (gxPrintingPanelKind) 2 /* printer driver panel */ }; typedef long gxPrintingPanelKind;Parse Range Results
enum { gxRangeNotParsed = (gxParsePageRangeResult) 0, /* not parsed yet */ gxRangeParsed = (gxParsePageRangeResult) 1, /* successful parse */ gxRangeBadFromValue= (gxParsePageRangeResult) 2, /* the "from page" */ /* value is invalid */ gxRangeBadToValue = (gxParsePageRangeResult) 3 /* the "to page" */ /* value is invalid */ }; typedef long gxParsePageRangeResult;Functions
Creating and Manipulating Format Objects
gxFormat GXNewFormat(gxJob aJob); void GXDisposeFormat(gxFormat aFormat); gxFormat GXCopyFormat(gxFormat srcFormat, gxFormat dstFormat); gxFormat GXCloneFormat(gxFormat aFormat); long GXCountJobFormats(gxJob aJob); long GXCountFormatOwners(gxFormat aFormat); void GXForEachJobFormatDo(gxJob aJob, gxFormatProc aFormatProc, void *refCon);Manipulating Format Object Properties
void GXGetFormatMapping(gxFormat aFormat, gxMapping *aMapping); gxPaperType GXGetFormatPaperType (gxFormat aFormat); gxShape GXGetFormatForm(gxFormat aFormat, gxShape *mask); void GXSetFormatForm(gxFormat aFormat, gxShape form, gxShape mask); void GXChangedFormat(gxFormat aFormat);Displaying the Custom Page Setup Dialog Box
gxDialogResult GXFormatDialog (gxFormat aFormat, gxEditMenuRecord *anEditMenuRecord, StringPtr title);Working With Panels
void GXSetupDialogPanel(gxPanelSetupRecord *aPanelSetupRecord); void GXGetJobPanelDimensions (gxJob aJob, Rect *aRect); void GXEnableJobScalingPanel (gxJob aJob, Boolean enabled); short GXGetMessageHandlerResFile (void);Accessing Printing-Related Collection Objects
Collection GXGetJobCollection (gxJob aJob); Collection GXGetFormatCollection (gxFormat aFormat); Collection GXGetPaperTypeCollection (gxPaperType aPaperType);Application-Defined Functions
Message Override Functions for Customizing Dialog Boxes
OSErr GXJobPrintDialog (gxDialogResult *aDialogResult); OSErr GXJobDefaultFormatDialog (gxDialogResult *aDialogResult); OSErr GXFormatDialog(gxFormat aFormat, StringPtr title, gxDialogResult *aDialogResult); OSErr GXHandlePanelEvent (gxPanelInfoRecord *aPanelInfoRecord, gxPanelResult *aPanelResult); OSErr GXFilterPanelEvent (gxPanelInfoRecord *aPanelInfoRecord, Boolean *returnImmed); OSErr GXParsePageRange (StringPtr fromString, StringPtr toString, gx ParsePageRangeResult *result);Looping Through Format Objects
gxLoopStatus MyFormatFunction (gxFormat aFormat, void *refCon);Dialog Box-Related Resources
The Panel Resource
type gxPrintPanelType { pstring[31]; /* the panel name */ integer Script;/* script ID */ fill word; /* reserve a long word for future use of international */ fill word; /* reserve a long word for future use of international */ integer; /* the icon ID */ integer; /* the item list ID */ };The Extended Item List Resource
type gxExtendedDITLType { integer = $$CountOf(xdtlarray) -1; wide array xdtlarray { switch { case RadioButtons: key integer = xdtlRadioButtons; literal longint; /* 4 byte id for storage in job object or format object */ longint; /* numerical id for storage in job object or format object */ integer; /* offset in bytes into item */ integer = $$CountOf(RadioButtonsArray) - 1; wide array RadioButtonsArray { byte; /* array of corresponding items*/ }; case CheckBox: key integer = xdtlCheckBox; literal longint; /* 4-byte ID for storage in job object or format object */ longint; /* numerical ID for storage in job object or format object */ integer; /* offset in bytes into item */ byte; /* corresponding ditl item */ fill byte; case EditTextInteger: key integer = xdtlEditTextInteger; literal longint; /* 4-byte ID for storage in job object or format object */ longint; /* numerical ID for storage in job object or format object */ integer; /* offset in bytes into item */ byte; /* corresponding item list's item */ byte; /* 0 = dont select, 1 = select */ pstring[15];/* low bound - nil means 'I don't care' */ pstring[15];/* high bound - nil means 'I don't care' */ case EditTextReal: key integer = xdtlEditTextReal; literal longint; /* 4-byte ID for storage in job object or format object */ longint; /* numerical ID for storage in job object or format object */ integer; /* offset in bytes into item */ byte; /* corresponding item list's item */ byte; /* 0 = don't select, 1 = select pstring[15];/* low bound - nil means 'I don't care' */ pstring[15];/* high bound - nil means 'I don't care' */ case EditTextString: key integer = xdtlEditTextString; literal longint; /* 4-byte ID for storage in job object */ /* or format object */ longint; /* numerical ID for storage in job object or format object */ integer; /* offset in bytes into item */ byte; /* corresponding item list's item */ byte; /* 0 = don't select, 1 = select */ case PopUp: key integer = xdtlPopUp; literal longint; /* 4-byte ID for storage in job object or format object */ longint; /* numerical ID for storage in job object or format object */ integer; /* offset in bytes into item */ byte; /* corresponding item list's item */ fill byte; }; align word; }; };
Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help